package com.kevin.learn.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.kevin.learn.entity.User;
import com.kevin.learn.service.OrderService;
import com.kevin.learn.service.UserService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.LinkedList;
import java.util.List;
import java.util.Queue;

import javax.annotation.Resource;

@RestController
@RequestMapping("/admin")
public class MyBatisController {

    @Autowired
    private UserService userService;

    @Resource(name = "orderServiceImpl")
    private OrderService orderService;


    @GetMapping("/hello")
    public List<User> hello() {
        Page<User> page = new Page<>();
        page.setCurrent(1);
        page.setSize(2);

        Queue<String> q = new LinkedList<>();
        List<User> users = userService.selectPageVo(page, 1);
        return users;
    }


    @GetMapping("/getInt")
    public Integer getInt() {
        int anInt = orderService.getInt(1);
        return anInt;
    }
}
